# 安装和加载 pheatmap 库
#install.packages("pheatmap")
rm(list=ls())
setwd("C:\\Users\\zzc\\Desktop\\")


library(pheatmap)

# 提供数据
data_matrix <- read.table("Prot_similarity_heatmap.txt", header = TRUE, row.names = 1)

my_color_palette <- c("grey", "grey", "grey", "grey", "grey", "pink", "pink", "gold", "orange", "orange")

# 绘制热图
pheatmap(data_matrix,
         color = my_color_palette,
         breaks = seq(0, 100, by = 10),
         main = "Protein similarity",
         cluster_rows = F,
         cluster_cols = F)

data_matrix2 <- read.table("PDB_similarity_heatmap.txt", header = TRUE, row.names = 1)

my_color_palette <- c("grey", "grey", "grey", "grey", "grey", "#9fe4ff", "#77c2ed", "#50a0db", "#287dc9", "#005bb7")

# 绘制热图
pheatmap(data_matrix2,
         color = my_color_palette,
         breaks = seq(0, 1, by = 0.1),
         main = "PDB TM-score",
         cluster_rows = F,
         cluster_cols = F)